<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>fsfirlin</title>
  </head>
  <body bgcolor="#FFFFFF">
    <center>Scilab Function</center>
    <div align="right">Last update : April 1993</div>
    <p>
      <b>fsfirlin</b> -  design of FIR, linear phase filters, frequency sampling technique</p>
    <h3>
      <font color="blue">Calling Sequence</font>
    </h3>
    <dl>
      <dd>
        <tt>[hst]=fsfirlin(hd,flag)  </tt>
      </dd>
    </dl>
    <h3>
      <font color="blue">Parameters</font>
    </h3>
    <ul>
      <li>
        <tt>
          <b>hd</b>
        </tt>: vector of desired frequency response samples</li>
      <li>
        <tt>
          <b>flag</b>
        </tt>: is equal to 1 or 2, according to the choice of type 1 or type 2 design</li>
      <li>
        <tt>
          <b>hst</b>
        </tt>: vector giving the approximated continuous response on a dense grid of frequencies</li>
    </ul>
    <h3>
      <font color="blue">Description</font>
    </h3>
    <p>
    function for the design of FIR, linear phase filters
    using the frequency sampling technique</p>
    <h3>
      <font color="blue">Examples</font>
    </h3>
    <pre>

//
//Example of how to use the fsfirlin macro for the design 
//of an FIR filter by a frequency sampling technique.
//
//Two filters are designed : the first (response hst1) with 
//abrupt transitions from 0 to 1 between passbands and stop 
//bands; the second (response hst2) with one sample in each 
//transition band (amplitude 0.5) for smoothing.
//
hd=[zeros(1,15) ones(1,10) zeros(1,39)];//desired samples
hst1=fsfirlin(hd,1);//filter with no sample in the transition
hd(15)=.5;hd(26)=.5;//samples in the transition bands
hst2=fsfirlin(hd,1);//corresponding filter
pas=1/prod(size(hst1))*.5;
fg=0:pas:.5;//normalized frequencies grid
plot2d([1 1].*.fg(1:257)',[hst1' hst2']);
// 2nd example
hd=[0*ones(1,15) ones(1,10) 0*ones(1,39)];//desired samples
hst1=fsfirlin(hd,1);//filter with no sample in the transition
hd(15)=.5;hd(26)=.5;//samples in the transition bands
hst2=fsfirlin(hd,1);//corresponding filter
pas=1/prod(size(hst1))*.5;
fg=0:pas:.5;//normalized frequencies grid
n=prod(size(hst1))
plot(fg(1:n),hst1);
plot2d(fg(1:n)',hst2',[3],"000");
 
  </pre>
    <h3>
      <font color="blue">See Also</font>
    </h3>
    <p>
      <a href="ffilt.htm">
        <tt>
          <b>ffilt</b>
        </tt>
      </a>,&nbsp;&nbsp;<a href="wfir.htm">
        <tt>
          <b>wfir</b>
        </tt>
      </a>,&nbsp;&nbsp;</p>
    <h3>
      <font color="blue">Author</font>
    </h3>
    <p>G. Le Vey</p>
  </body>
</html>
